home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 140
/
Gekkan Dennou Club - 2000.1 Vol. 140 (Japan).7z
/
Gekkan Dennou Club - 2000.1 Vol. 140 (Japan) (Track 1).bin
/
games
/
km21
/
src
/
tnum.c
< prev
next >
Wrap
Text File
|
1999-12-05
|
4KB
|
222 lines
/*
tnum.c
スプライトに定義されている数字をテキストに
現在:アルファベット入り
*/
unsigned char TNUM__buf[64][8*16/8*4]; //バイト毎にプレーン移動
unsigned short TNUM__palet[16];
int TNUM__Init()
{
int ssp;
short spnum=0;
short palnum=0x09;
short nn,ln;
unsigned int *spptr,dot[8];
unsigned char *tnptr,mb;
spfile_def("TNUM.SP",0x00); //スプライト読み込み
palfile_def("TNUM.PAL",0x01);
ssp=B_SUPER(0);
{
short *crtc_r21=0xE8002A;
*crtc_r21&=0xfeff; //テキスト同時アクセス禁止
}
{ //パレット設定
unsigned short *s,*d,*d1,ln;
s=0xe82200+32*palnum;
d=0xe82200;
d1=TNUM__palet;
for( ln=0; ln<16; ln++ ){
*d++=*s;
*d1++=*s++;
}
// d=0xe82200;*d=0xf000;
}
for( nn=0; nn<64; nn++ ){
int sf;
spptr=0xEB8000+(spnum+nn)*0x80;
tnptr=TNUM__buf[nn];
for( ln=0; ln<16; ln++ ){
dot[0]=(*spptr&0xf0000000)>>28;
dot[1]=(*spptr&0x0f000000)>>24;
dot[2]=(*spptr&0x00f00000)>>20;
dot[3]=(*spptr&0x000f0000)>>16;
dot[4]=(*spptr&0x0000f000)>>12;
dot[5]=(*spptr&0x00000f00)>> 8;
dot[6]=(*spptr&0x000000f0)>> 4;
dot[7]=(*spptr&0x0000000f);
spptr++;
for( mb=0x01,sf=0; mb<=0x08; mb<<=1,sf++ ){
*tnptr=0;
*tnptr|=(((dot[0]&mb)>>sf)<<7);
*tnptr|=(((dot[1]&mb)>>sf)<<6);
*tnptr|=(((dot[2]&mb)>>sf)<<5);
*tnptr|=(((dot[3]&mb)>>sf)<<4);
*tnptr|=(((dot[4]&mb)>>sf)<<3);
*tnptr|=(((dot[5]&mb)>>sf)<<2);
*tnptr|=(((dot[6]&mb)>>sf)<<1);
*tnptr|=(((dot[7]&mb)>>sf));
tnptr++;
}
}
}
if( ssp>0 ){ B_SUPER(ssp); }
}
int TNUM__SetPalet()
{ //パレット設定
unsigned short *s,*d,ln;
d=0xe82200;
s=TNUM__palet;
for( ln=0; ln<16; ln++ ){
*d++=*s++;
}
}
int TNUM__Print(x,y,num)
int x,y,num; //num=0~9
{
unsigned char *base=0xe00000,*vram;
unsigned char *tnptr;
short ln;
char numstr[80];
tnptr=TNUM__buf[num+16];
base+=(y*2048+x);
for( ln=0; ln<16; ln++ ){
vram=base;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
base+=128;
}
}
int TASC__Print(x,y,cc)
int x,y;
char cc; //cc=0x20~0x5f
{
unsigned char *base=0xe00000,*vram;
unsigned char *tnptr;
short ln;
char numstr[80];
tnptr=TNUM__buf[cc-0x20];
base+=(y*2048+x);
for( ln=0; ln<16; ln++ ){
vram=base;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
*vram=*tnptr++; vram+=0x20000;
base+=128;
}
}
int TNUM__PrintSP(x,y)
int x,y;
{
unsigned char *base=0xe00000,*vram;
unsigned char sp=0;
short ln;
{
short *crtc_r21=0xE8002A;
*crtc_r21&=0xfeff; //テキスト同時アクセス禁止
}
base+=(y*2048+x);
for( ln=0; ln<16; ln++ ){
vram=base;
*vram=sp; vram+=0x20000;
*vram=sp; vram+=0x20000;
*vram=sp; vram+=0x20000;
*vram=sp; vram+=0x20000;
base+=128;
}
}
int PrintTD(x,y,num)
int x,y,num;
{
char buf[16],bn;
sprintf(buf,"%d",num);
for( bn=0; bn<strlen(buf); bn++ ){
TNUM__Print(x+bn,y,buf[bn]-'0');
}
}
int Print09d(x,y,num)
int x,y,num;
{
char buf[10],bn;
sprintf(buf,"%09d",num);
for( bn=0; bn<9; bn++ ){
TNUM__Print(x+bn,y,buf[bn]-'0');
}
}
int Print09SP(x,y)
int x,y;
{
short bn;
for( bn=0; bn<9; bn++ ){
TNUM__PrintSP(x+bn,y);
}
}
int PrintSPN(x,y,n)
int x,y;
{
short bn;
for( bn=0; bn<n; bn++ ){
TNUM__PrintSP(x+n,y);
}
}
int PrintSTR(x,y,str)
int x,y;
char *str;
{
char bn;
for( bn=0; bn<strlen(str); bn++ ){
TASC__Print(x+bn,y,str[bn]);
}
}